home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_vol_dart_trap.cog < prev    next >
Text File  |  1999-11-15  |  10KB  |  401 lines

  1. # Jones 3D Cog Script
  2. #
  3. # VOL_Dart_Trap.cog
  4. #
  5. # This cog will run a 3 location dart firing sequence upon an entered message.
  6. #
  7. # [CM & revised by HB]
  8. #
  9. # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
  10. # ========================================================================================
  11.  
  12. symbols
  13.  
  14.  
  15. #....................MESSAGES.....................#
  16. message    startup
  17. message    touched
  18. message    entered
  19. message    arrived
  20. message    pulse
  21. message    timer
  22. message    killed
  23.  
  24.  
  25. #....................ACTORS.....................#
  26. thing    player                                                local
  27. thing    indyActor                                                
  28. thing    tempSCORP0                                            local                                                
  29. thing    tempSCORP1                                            local                                                
  30. thing    tempSCORP2                                            local                                                
  31.  
  32.  
  33. #....................CAMERAS.....................#
  34.  
  35. thing    warningCam
  36. thing    dooroutsideCam
  37. thing    doorinsideCam
  38. thing    doorlookpos
  39. thing    cam1spot                                            local
  40. thing    cam1look                                            local
  41.  
  42. #....................COGS.....................#
  43. cog        doortalkcog
  44.  
  45.  
  46. #....................EVENT GHOSTS.....................#
  47. thing    smoke                                                local
  48. thing    dartgenpos0
  49. thing    dartgenpos1
  50. thing    dartgenpos2
  51.  
  52. thing    scorpgenPOS
  53. thing    scorpmovPOS
  54.  
  55.  
  56. #....................PROPS.....................#
  57. thing    door
  58. thing    pushblock
  59.  
  60. thing    missile0                                            local
  61. thing    missile1                                            local
  62. thing    missile2                                            local
  63. thing    deadmissile                                            local
  64.  
  65. #....................TRIGGERS.....................#
  66.  
  67. sector    in_sect
  68. sector    out_sect
  69. sector    primesect
  70. sector    endSECT
  71.  
  72. surface    triggersurf0
  73. surface    triggersurf1
  74. surface    triggersurf2
  75.  
  76. #....................KEYFRAMES....................#
  77. keyframe    in_hat=0in_figithat_4_4.key                        local
  78. keyframe    in_brush=0in_stand1_bd_4.key                    local
  79. keyframe    in_stand4=0in_stand4.key                        local
  80.  
  81.  
  82. #....................TEMPLATES.....................#
  83. template    dtemp=dart                                      local 
  84. template    smoketemplate=+dartsmoke_spr                    local
  85. template    scorp=scorpian                                    local
  86. template    tpl_ghost=ghost                                    local
  87.  
  88. #....................SOUNDS.....................#
  89. sound    blast=pru_dart_fired_c.wav                            local
  90. sound    tink=shs_bell_dull.wav                                local    #must be pitch-bent for proper effect
  91. sound    readytrap=teo_crush_prime_c.wav                        local
  92. sound    stab=fol_sp_attack.wav                                local
  93. sound    in_creepyfeel=INXJ048.WAV                            local
  94.  
  95. sound    creepy_cue=mus_gen_danger3.wav                        local
  96.  
  97. #....................VARIABLES.....................#
  98. int        scene=0                                                local
  99. int        hitsound                                            local
  100. int        snd                                                    local
  101. int        track                                                local
  102. int        playerpos=0                                            local
  103. int        scorpCOUNT=0                                        local
  104. int        scorpTOTAL=0                                        local
  105. int        TIMERID_MAKESCORP=1                                    local
  106. int        TIMERID_MOVEIT=2                                    local
  107. int        vibe                                                local
  108. thing    t_scorpWakeUp                                        local
  109.  
  110. end
  111.  
  112. # ========================================================================================
  113. code
  114.  
  115. startup:
  116.  
  117.     # get the player
  118.     player = GetLocalPlayerThing();
  119.     return;
  120.  
  121. # ========================================================================================
  122. entered:
  123.  
  124.     If ((GetSenderRef() == primesect) && (GetSourceRef() == player))
  125.     {
  126.         If (scene == 1) return;
  127.         
  128.         scene = 1;
  129.         # stop the player's motion, and swap the actor in
  130.         MakeMeStop();
  131.         StartCutScene(1);
  132.         TeleportThing(indyActor, player);
  133.         SetThingFlags(player, 0x80000);
  134.         ClearThingFlags(indyActor, 0x80000);
  135.         CopyPlayerHolsters(player, indyActor);
  136.  
  137.         PlaySoundLocal(readytrap, 0.5, 1.0, 0x0, 0);
  138.                     
  139.         # line up the actor
  140.         AISetLookThing(indyActor, dartgenpos0);
  141.  
  142.         # move cam...
  143.         cam1spot = CreateThing(tpl_ghost, player);
  144.         CaptureThing(cam1spot);
  145.         cam1look = CreateThing(tpl_ghost, player);
  146.         CaptureThing(cam1look);
  147.         MakeCamera2LikeCamera1(cam1spot, cam1look);
  148.         SetCameraLookInterp(2, 0);
  149.         SetCameraPosInterp(2, 0);
  150.         SetCameraFocus(2, cam1spot);
  151.         SetCameraSecondaryFocus(2, cam1look);
  152.         SetCurrentCamera(2);
  153.         ResetCameraFOV(0, 0.0);
  154.         Sleep(0.01);
  155.         SetCameraLookInterp(2, 1);
  156.         SetCameraPosInterp(2, 1);
  157.         SetCameraInterpSpeed(2, 0.8);
  158.         Sleep(0.01);
  159.         SetCameraFocus(2, warningCam);
  160.         AIWaitForStop(indyActor);
  161.  
  162.         PlaySoundLocal(creepy_cue, 0.5, 1.0, 0x0, 0);
  163.         
  164.         # play indy's anims and voice line
  165.         track = PlayKey(indyActor, in_Stand4, 2, 0x0, 0);
  166.         PlayKey(indyActor, in_brush, 4, 0x12, 1);
  167.         snd = PlayVoice(indyActor, in_creepyfeel, 0.75, 0);
  168.         PlayKey(indyActor, in_hat, 4, 0x12, 0);
  169.         WaitForSound(snd);
  170.         Sleep(0.8);
  171.         SetCameraInterpSpeed(2, 1.5);
  172.         Sleep(0.2);
  173.  
  174.         # begin screenshake
  175.         SetPulse(0.04);
  176.         Sleep(0.1);
  177.  
  178.         # offset camera target to the door
  179.         SetCameraSecondaryFocus(2, doorlookpos);
  180.         Sleep(0.5);
  181.  
  182.         # close the door forever
  183.         MoveToFrame(door, 0, 1.0);
  184.         WaitForStop(door);
  185.  
  186.         # stop the screenshake
  187.         SetPulse(0.0);
  188.  
  189.         # restore the player
  190.         TeleportThing(player, indyActor);
  191.         ClearThingFlags(player, 0x80000);
  192.         SetThingFlags(indyActor, 0x80000);
  193.         Sleep(0.5);
  194.  
  195.         # end the scene
  196.         SetCameraLookInterp(2, 0);
  197.         SetCameraPosInterp(2, 0);
  198.         SetCameraPosition(1, GetThingPos(warningCam));
  199.         SetCurrentCamera(1);
  200.         ResetCameraFOV(0, 0.0);
  201.  
  202.         EndCutscene();
  203.         ClearActorFlags(player, 0x200000);
  204.         SetTimerEx(4.0, TIMERID_MAKESCORP, 0, 0);
  205.     }
  206.  
  207.     If (GetSenderRef() == triggersurf0)
  208.     {
  209.         smoke = CreateThing(smoketemplate, dartgenpos0);
  210.         AnimateSpriteSize(smoke, '0.05 0.05 1.0', '0.2 0.2 0.0', 0.5);
  211.         missile0 = CreateThing(dtemp, dartgenpos0);
  212.         CaptureThing(missile0);
  213.         PlaySoundThing(blast, missile0, 2.0, 0, 20, 0);
  214.         MoveToFrame(missile0, 1, 10);
  215.         Sleep(.25);
  216.     }
  217.     
  218.  
  219.     If (GetSenderRef() == triggersurf1)
  220.     {
  221.         smoke = CreateThing(smoketemplate, dartgenpos1);
  222.         AnimateSpriteSize(smoke, '0.05 0.05 1.0', '0.2 0.2 0.0', 0.5);
  223.         missile1 = CreateThing(dtemp, dartgenpos1);
  224.         CaptureThing(missile1);
  225.         PlaySoundThing(blast, missile1, 2.0, 0, 20, 0);
  226.         MoveToFrame(missile1, 1, 10);
  227.         Sleep(.25);
  228.         }
  229.     
  230.  
  231.     If (GetSenderRef() == triggersurf2)
  232.     {
  233.         smoke = CreateThing(smoketemplate, dartgenpos2);
  234.         AnimateSpriteSize(smoke, '0.05 0.05 1.0', '0.2 0.2 0.0', 0.5);
  235.         missile2 = CreateThing(dtemp, dartgenpos2);
  236.         CaptureThing(missile2);
  237.         PlaySoundThing(blast, missile2, 2.0, 0, 20, 0);
  238.         MoveToFrame(missile2, 1, 10);
  239.         Sleep(.25);
  240.     }
  241.  
  242.     If (GetSenderRef() == in_sect)
  243.     {
  244.         playerpos=1;
  245.     }
  246.  
  247.     If (GetSenderRef() == out_sect)
  248.         {
  249.         playerpos=2;
  250.         }
  251.  
  252.     If (GetSenderRef() == endSECT)
  253.     {
  254.         KillTimerEx(TIMERID_MAKESCORP);
  255.     }
  256.     
  257. return;
  258.  
  259. # ========================================================================================
  260. arrived:
  261.  
  262.     If (GetSenderRef() == missile0)
  263.         {
  264.             DestroyThing(missile0);
  265.             hitsound = PlaySoundLocal(tink, 0.1, -1, 0x0, 0);
  266.             #ChangeSoundPitch(hitsound, 6, 0);
  267.         }
  268.  
  269.     If (GetSenderRef() == missile1)
  270.         {
  271.             DestroyThing(missile1);
  272.             hitsound = PlaySoundLocal(tink, 0.1, -1, 0x0, 0);
  273.             #ChangeSoundPitch(hitsound, 6, 0);
  274.         }
  275.  
  276.     If (GetSenderRef() == missile2)
  277.         {
  278.             DestroyThing(missile2);
  279.             hitsound = PlaySoundLocal(tink, 0.1, -1, 0x0, 0);
  280.             #ChangeSoundPitch(hitsound, 6, 0);
  281.         }
  282. return;
  283.  
  284.  
  285. # ========================================================================================
  286. pulse:
  287.  
  288.     vibe = RandBetween(0, 2);
  289.     if (vibe == 0)
  290.     {
  291.         SetPOVShake('0.0 0.0 0.008', '0.0 0.0 0.0', 80.0, 0.8);
  292.     }
  293.         if (vibe == 1)
  294.     {
  295.         SetPOVShake('0.01 0.0 0.02', '0.0 0.0 0.0', 80.0, 0.8);
  296.     }
  297.     if (vibe == 2)
  298.     {
  299.         SetPOVShake('0.0 0.01 0.01', '0.0 0.0 0.0', 80.0, 0.8);
  300.     }
  301.     return;
  302.  
  303. # ========================================================================================
  304. touched:
  305.  
  306.  
  307. if ((GetSenderRef() == missile0) && (GetSourceRef() == GetLocalPlayerThing()))
  308.     {
  309.     # Print("ouch");
  310.     DamageThing(GetSourceRef(), 150.0, 0x1, missile0);
  311.     
  312.     PlaySoundLocal(stab, 1.0, 0.0, 0x0, 0);
  313.     DestroyThing(missile0);
  314.     }
  315.  
  316.  
  317. if ((GetSenderRef() == missile1) && (GetSourceRef() == GetLocalPlayerThing()))
  318.     {
  319.     #Print("ouch");
  320.     DamageThing(GetSourceRef(), 150.0, 0x1, missile1);
  321.     
  322.     PlaySoundLocal(stab, 1.0, 0.0, 0x0, 0);
  323.     DestroyThing(missile1);
  324.     }
  325.  
  326.  
  327. if ((GetSenderRef() == missile2) && (GetSourceRef() == GetLocalPlayerThing()))
  328.     {
  329.     #Print("ouch");
  330.     DamageThing(GetSourceRef(), 150.0, 0x1, missile2);
  331.     
  332.     PlaySoundLocal(stab, 1.0, 0.0, 0x0, 0);
  333.     DestroyThing(missile2);
  334.     }
  335.     
  336.     
  337. return;
  338.  
  339.  
  340.  
  341. # ========================================================================================
  342.  
  343. # ========================================================================================
  344. timer:
  345.  
  346.     if ( GetSenderID() == TIMERID_MAKESCORP )
  347.     {
  348.         if ( scorpTOTAL == 9 )
  349.         {
  350.             return;
  351.         }
  352.  
  353.         # renew the timer
  354.         SetTimerEx(6.0, TIMERID_MAKESCORP, 0, 0);
  355.  
  356.         If (scorpCOUNT == 3)
  357.         {
  358.             return;
  359.         }
  360.  
  361.         # scorpion generating routine
  362.         tempSCORP0[scorpCOUNT]=CreateThing(scorp, scorpgenPOS);
  363.         if ( tempSCORP0[scorpCOUNT] > -1 )
  364.         {
  365.             CaptureThing(tempSCORP0[scorpCOUNT]);
  366.             AISetCutSceneMode(tempSCORP0[scorpCOUNT]);
  367.             AISetMoveThing(tempSCORP0[scorpCOUNT], scorpmovPOS, 0);
  368.         
  369.             SetTimerEx(1, TIMERID_MOVEIT, tempSCORP0[scorpCOUNT], 0);
  370.  
  371.             scorpCOUNT = scorpCOUNT + 1;
  372.             scorpTOTAL = scorpTOTAL + 1;
  373.         }
  374.     }
  375.  
  376.     if ( GetSenderID() == TIMERID_MOVEIT )
  377.     {
  378.         t_scorpWakeUp = GetParam(0);
  379.  
  380.         AIClearCutSceneMode(t_scorpWakeUp);
  381.         AISetFireTarget(t_scorpWakeUp, player);
  382.     }
  383.  
  384. return;
  385.  
  386. # ========================================================================================
  387. killed:
  388.  
  389. if ((GetSenderRef() == tempSCORP0) || (GetSenderRef() == tempSCORP1) || (GetSenderRef() == tempSCORP2))
  390.     {
  391.     scorpCOUNT = scorpCOUNT - 1;
  392.     }
  393. return;
  394.  
  395. # ========================================================================================
  396. end
  397.  
  398.  
  399.  
  400.  
  401.